From 2e6b8810c03755404609d8f32417df71180bacff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 12 Jul 2020 10:34:27 -0400 Subject: [PATCH] filechooserdialog: Stop using the embed interface Just call private GtkFileChooserWidget api. There is no real justification for diverting this through an extra interface. --- gtk/gtkfilechooserdialog.c | 5 ++--- gtk/gtkfilechooserwidget.c | 27 +++++---------------------- gtk/gtkfilechooserwidgetprivate.h | 6 ++++++ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index d27ba8e3c0..094a25f15b 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -25,7 +25,6 @@ #include "gtkfilechooserwidget.h" #include "gtkfilechooserwidgetprivate.h" #include "gtkfilechooserutils.h" -#include "gtkfilechooserembed.h" #include "gtksizerequest.h" #include "gtktypebuiltins.h" #include "gtkintl.h" @@ -606,7 +605,7 @@ gtk_file_chooser_dialog_map (GtkWidget *widget) setup_save_entry (dialog); ensure_default_response (dialog); - _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget)); + gtk_file_chooser_widget_initial_focus (GTK_FILE_CHOOSER_WIDGET (priv->widget)); GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->map (widget); } @@ -670,7 +669,7 @@ response_cb (GtkDialog *dialog, /* Act only on response IDs we recognize */ if (is_accept_response_id (response_id) && !priv->response_requested && - !_gtk_file_chooser_embed_should_respond (GTK_FILE_CHOOSER_EMBED (priv->widget))) + !gtk_file_chooser_widget_should_respond (GTK_FILE_CHOOSER_WIDGET (priv->widget))) { g_signal_stop_emission_by_name (dialog, "response"); } diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index f431dbadf0..5eebc04bd3 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -34,7 +34,6 @@ #include "gtkentry.h" #include "gtkfilechooserprivate.h" #include "gtkfilechooserdialog.h" -#include "gtkfilechooserembed.h" #include "gtkfilechooserentry.h" #include "gtkfilechooserutils.h" #include "gtkfilechooser.h" @@ -388,7 +387,6 @@ enum { #define ICON_SIZE 16 static void gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface); -static void gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface); static void gtk_file_chooser_widget_constructed (GObject *object); static void gtk_file_chooser_widget_finalize (GObject *object); @@ -441,9 +439,6 @@ static gboolean gtk_file_chooser_widget_remove_shortcut_folder (GtkFileCho GError **error); static GListModel * gtk_file_chooser_widget_get_shortcut_folders (GtkFileChooser *chooser); -static gboolean gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed); -static void gtk_file_chooser_widget_initial_focus (GtkFileChooserEmbed *chooser_embed); - static void gtk_file_chooser_widget_add_choice (GtkFileChooser *chooser, const char *id, const char *label, @@ -547,9 +542,7 @@ static void set_show_hidden (GtkFileChooserWidget *impl, G_DEFINE_TYPE_WITH_CODE (GtkFileChooserWidget, gtk_file_chooser_widget, GTK_TYPE_WIDGET, G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER, - gtk_file_chooser_widget_iface_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED, - gtk_file_chooser_embed_default_iface_init)); + gtk_file_chooser_widget_iface_init)) static void gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface) @@ -575,13 +568,6 @@ gtk_file_chooser_widget_iface_init (GtkFileChooserIface *iface) iface->get_choice = gtk_file_chooser_widget_get_choice; } -static void -gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface) -{ - iface->should_respond = gtk_file_chooser_widget_should_respond; - iface->initial_focus = gtk_file_chooser_widget_initial_focus; -} - static void pending_select_files_free (GtkFileChooserWidget *impl) { @@ -6117,10 +6103,9 @@ add_selection_to_recent_list (GtkFileChooserWidget *impl) g_object_unref (files); } -static gboolean -gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed) +gboolean +gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *impl) { - GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed); GtkWidget *toplevel; GtkWidget *current_focus; gboolean retval; @@ -6366,11 +6351,9 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed) return retval; } -/* Implementation for GtkFileChooserEmbed::initial_focus() */ -static void -gtk_file_chooser_widget_initial_focus (GtkFileChooserEmbed *chooser_embed) +void +gtk_file_chooser_widget_initial_focus (GtkFileChooserWidget *impl) { - GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (chooser_embed); GtkWidget *widget; if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN || diff --git a/gtk/gtkfilechooserwidgetprivate.h b/gtk/gtkfilechooserwidgetprivate.h index 2c00f6ff8a..07b0ce3897 100644 --- a/gtk/gtkfilechooserwidgetprivate.h +++ b/gtk/gtkfilechooserwidgetprivate.h @@ -30,6 +30,12 @@ void gtk_file_chooser_widget_set_save_entry (GtkFileChooserWidget *chooser, GtkWidget *entry); +gboolean +gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *chooser); + +void +gtk_file_chooser_widget_initial_focus (GtkFileChooserWidget *chooser); + G_END_DECLS #endif /* __GTK_FILE_CHOOSER_WIDGET_PRIVATE_H__ */ -- 2.30.2